package com.leyuangame.core.websocket.client;

import com.leyuangame.core.websocket.handler.BeiMiClient;
import com.leyuangame.core.websocket.message.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class NettyClients {
	
	private static NettySystemClient systemClients;

    public static NettySystemClient getSystemClients() {
        return systemClients;
    }

    @Autowired
    public void setSystemClients(NettySystemClient systemClients) {
        NettyClients.systemClients = systemClients;
    }

    public static NettySystemClient getInstance(){
		return systemClients ;
	}
	
	public void putGameEventClient(String id , BeiMiClient gameClient){
		//systemClients.putClient(id, gameClient);
	}
	public void removeGameEventClient(String id){
		systemClients.removeClient(id);
	}
	public void sendGameEventMessage(String id , String event , Message data){
		systemClients.getClient(id).sendEvent(event, data);
	}
}
